Segmentation fault occurs if DOMID isn't specified.
Some check be added to output error message in this situation.
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
exit(EINVAL);
}
}
-
+
+ if (optind >= argc) {
+ fprintf(stderr, "DOMID should be specified\n");
+ fprintf(stderr, "Try `%s --help' for more information.\n",
+ argv[0]);
+ exit(EINVAL);
+ }
domid = strtol(argv[optind], &end, 10);
if (end && *end) {
fprintf(stderr, "Invalid DOMID `%s'\n", argv[optind]);